var debug = process.env.NODE_ENV !== "producrtion";
var webpack = require('webpack');
var path = require('path');

module.exports = {
    context: path.join(__dirname),
    devtool:debug ? "inline-sourcemap" : null,
    entry:"./src/js/root.js",
    module: {
        loaders: [
            {
            test:/\.js?$/,
            exclude:/(node_modules)/,
            loader:'babel-loader',
            query:{
                presets:['react','es2015'],
                plugins:['react-html-attrs']
            }
        },
            {test:/\.css$/, loader: 'style-loader!css-loader'}
        ]
    },
    output:{
        path:__dirname,
        filename :"./src/bundle.js"
    },
    plugins: debug ? [] : [
        new webpack.optimize.DebugPlugin(),
        new webpack.optimize.OccurrenceOrderPlugin(),
        new webpack.optimize.UglifyJSPlugin({mangle:false,sourcemap:false}),
    ],
};